package dr.request.admin.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dr.controller.*;
import dr.request.dao.RequestDAO;
import dr.request.domain.Request;

public class RequestUpdateFormAction extends ActionSupportLogin{
	
	public String execute(HttpServletRequest request, 
			HttpServletResponse response) throws Throwable{

		String id=getUserLoginId(request);// session
		
		//admin check
		if(!id.equals("admin")) return ADMINNULL_PATH;
		//admin check
		
		int num = Integer.parseInt(request.getParameter("num"));
		String pageNum = request.getParameter("pageNum");
		
		RequestDAO reqDAO = RequestDAO.getInstance();
		Request req = reqDAO.updateGetArticle(num);
		
		request.setAttribute("req", req);
		request.setAttribute("pageNum", pageNum);
		
		return "/adminRequest/updateForm.jsp";
	}

}
